import { ImageIndexType } from './product-type';

export function fillFlagByItemKey(itemKey: string) {
  const imageDto: ImageIndexType = {
    id: null,
    flag1: null,
    flag2: null,
    flag3: null,
    productTime: null,
    hour: null,
    ageing: null,
  };
  const itemList = itemKey.split('#');
  if (itemList.length >= 1) {
    imageDto.flag1 = itemList[0];
  }
  if (itemList.length >= 2) {
    imageDto.flag2 = itemList[1];
  }
  if (itemList.length >= 3) {
    imageDto.flag3 = itemList[2];
  }
  return imageDto;
}
